package org.jackysoft.struts2.workflow;
import java.util.Collection;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Namespace;
import org.jackysoft.entity.VariableSetting;
import org.jackysoft.service.VariableSettingService;
import org.jackysoft.struts2.workflow.AbstractWorkflowAction;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;



@Namespace("/variablesetting")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class VariableSettingAction extends AbstractWorkflowAction<VariableSetting> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 984989205475481486L;
	private VariableSettingService service;
	private VariableSetting bean;
	private Collection<VariableSetting> beans;	
	private String name;
	
	public String byworkflow() throws Exception{
		beans = service.getsByWorkflow(workflowPk);		
		return "byworkflow";
		
	}
	
	public String get() throws Exception{
		bean = service.get(workflowPk, name);
		return BEANDATA;
	}
	
	
		
	public void setBean(VariableSetting bean){
	     this.bean = bean;
	}
	public VariableSetting getBean(){
	     return this.bean;
	}
	public void setBeans(Collection<VariableSetting> beans){
	
	     this.beans = beans;
	}
	public Collection<VariableSetting> getBeans(){
	     return this.beans;
	}
	
	@Resource
	public void setService(VariableSettingService service) {
		this.service = service;
		this.setDataProvider(service);
	}	
	
	public VariableSettingService getService(){
	   return this.service;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
		
}